﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using MySql.Data.MySqlClient;
using IPTV.dao;
using IPTV.module;
using System.Data;
using IPTV.util;

/// <summary>
///indexService 的摘要说明
/// </summary>
namespace IPTV.service
{
    public class CourseDetailService
    {
        public CourseDetailService()
        {
            
        }

        public TeacherDto getTeacherById(string teacherId)
        {
            TeacherDao teacherDao = new TeacherDao();
            return teacherDao.findTeacherById(teacherId);
        }

        public CourseDto getCourseById(string courseId)
        {
            CourseDao courseDao = new CourseDao();
            return courseDao.findCourseById(courseId);
        }

        public string  getTagById(string tagIds)
        {
            String[] tempIds = tagIds.Split(';');
            string tempPara = "";
            List<String> paraList = new List<string>();
            for (int i = 0; i < tempIds.Length; i++ )
            {
                string tmp = tempIds[i];
                if (!tmp.Equals(""))
                {
                    String[] tmp2 = tmp.Split('$');

                    for (int j = 0; j < tmp2.Length; j++)
                    {
                        if (!"".Equals(tmp2[j].Trim()))
                        {
                            paraList.Add(tmp2[j]);

                        }
                    }
                }

            }

            for(int i =0;i<paraList.Count ; i++)
            {
                tempPara += "'" + paraList[i] + "'";
                if(i!= paraList.Count  -1)
                {
                    tempPara+=",";
                }

            }

            DictionaryDao dictionaryDao = new DictionaryDao();
           return dictionaryDao.findTags(tempPara);
        }
    }


}